# -*- coding:utf-8 -*-
# @Time : 2020/1/9 14:36
# @Author: liangkun
# @File : 接口入门测试第一讲
# @Des :接口测试第一讲
# 1、看接口文档 get post

# 学习资料 https://www.bilibili.com/video/av35122164?p=7

# 以一天api为例
# http://co-api.51wnl.com/calendar/vacations?token = A2E0C3CDEA081D3BFC34F8FE23A15886 & type = 1×tamp = 1462377600 & client = ceshi
# http://192.168.31.215:8095/?getHomeData={} 项目首页
import requests
from pprint import pprint  # 好看的打印
import pickle, json

# get请求
res = requests.get(
    'http://192.168.31.215:8095/?getHomeData={}')
# 设置打印宽度
# pprint(res.json(), width=100)

# post请求----
# 验证码：http://113.57.153.138:38080//userControl/sendCode/none  带body--json请求的，
body = {'phone': '13713581347'}
respost = requests.post('http://113.57.153.138:38080//userControl/sendCode/none', json=body)
pprint(respost.json(), width=100)
pprint(respost.json()['data'], width=100)
